import matplotlib.pyplot as plt
import numpy as np

plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
#直方图记录数据频次
data = np.random.normal(0, 1, 1000)
plt.figure(figsize=(10, 6))
plt.hist(data, bins=30, color='skyblue', edgecolor='red', alpha=0.5)

plt.title('直方图示例')
plt.xlabel('值')
plt.ylabel('频数')
plt.grid(True)
plt.show()